#ifndef _INTERPRETER_H_
#define _INTERPRETER_H_

class Context
{
public:
    Context(int num)
    {
        _num = num;
    }

    void SetNum(int num)
    {
        _num = num;
    }

    int GetNum()
    {
        return _num;
    }

    void SetRes(int res)
    {
        _res = res;
    }

    int GetRes()
    {
        return _res;
    }
private:
    int _num;
    int _res;
};

class Expression
{
public:
    virtual void Interpreter(Context* context) = 0;
};

class PlusExpression : public Expression
{
public:
    virtual void Interpreter(Context* context)
    {
        int num = context->GetNum();
        ++num;
        context->SetNum(num);
        context->SetRes(num);
    }
};

class MinusExpression : public Expression
{
    virtual void Interpreter(Context* context)
    {
        int num = context->GetNum();
        --num;
        context->SetNum(num);
        context->SetRes(num);
    }
};

#endif // _INTERPRETER_H_